package collection;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

/**
 对Point集合进行排序
 */
public class SortPoint {
    public static void main(String[] args) {
        List<Point>list=new ArrayList<>();
        list.add(new Point(3,3));
        list.add(new Point(34,33));
        list.add(new Point(2,35));
        list.add(new Point(76,4));
        list.add(new Point(4,64));
        System.out.println("原始数据"+list);
        Collections.sort(list,( o1,  o2) -> o2.getX()-o1.getX());
        System.out.println("list排序后数据"+list);

    }
}
